import { useUserStore } from '@/stores/user'

/**
 * 检查是否有指定权限
 * @param {String} permission 权限标识
 * @returns {Boolean}
 */
export function hasPermission(permission) {
  const userStore = useUserStore()
  return userStore.hasPermission(permission)
}

/**
 * 检查是否有指定角色
 * @param {String} roleKey 角色标识
 * @returns {Boolean}
 */
export function hasRole(roleKey) {
  const userStore = useUserStore()
  return userStore.hasRole(roleKey)
}

/**
 * 检查是否是管理员
 * @returns {Boolean}
 */
export function isAdmin() {
  const userStore = useUserStore()
  return userStore.isAdmin()
}